//
//  LOLinformationTabCell.m
//  LOLXXbox
//
//  Created by mac on 16/2/27.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLinformationTabCell.h"
#define WIDTH [[UIScreen mainScreen]bounds].size.width
@implementation LOLinformationTabCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.nameLabel=[[UILabel alloc]init];
        self.nameLabel.text=@"英雄数据";
        self.nameLabel.font=[UIFont systemFontOfSize:16];
        self.nameLabel.textColor=[UIColor colorWithRed:0.254 green:0.822 blue:1.000 alpha:0.750];
        [self.contentView addSubview:self.nameLabel];

        
        
        
        self.levelSlider=[[UISlider alloc]init];
        self.levelSlider.minimumValue=1;
        self.levelSlider.maximumValue=18;
        [self.levelSlider setValue:1];
        [self.levelSlider addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventValueChanged];
        [self.contentView addSubview:self.levelSlider];

        
        
        self.levelLabel=[[UILabel alloc]init];
        self.levelLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.levelLabel];

        
        
        self.attackLabel=[[UILabel alloc]init];
        self.attackLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.attackLabel];

        
        self.speedLabel=[[UILabel alloc]init];
        self.speedLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.speedLabel];

        
        self.baseAttackLabel=[[UILabel alloc]init];
        self.baseAttackLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.baseAttackLabel];

        
        self.baseDefenseLabel=[[UILabel alloc]init];
        self.baseDefenseLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.baseDefenseLabel];

        
        self.baseMagicLabel = [[UILabel alloc]init];
        self.baseMagicLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.baseMagicLabel];

        
        self.baseHealthLabel = [[UILabel alloc]init];
        self.baseHealthLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.baseHealthLabel];

        
        self.crushLabel = [[UILabel alloc]init];
        self.crushLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.crushLabel];

        
        self.magicRecoverLabel = [[UILabel alloc]init];
        self.magicRecoverLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.magicRecoverLabel];

        
        self.healthRecoverLabel = [[UILabel alloc]init];
        self.healthRecoverLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.healthRecoverLabel];

        
        self.magicdefenseLabel=[[UILabel alloc]init];
        self.magicdefenseLabel.font=[UIFont systemFontOfSize:13];
        [self.contentView addSubview:self.magicdefenseLabel];

        
        
        NSArray *arr=@[@"等级:",@"攻击距离:",@"移动速度:",@"基础攻击:",@"基础防御:",@"基础魔法值:",@"基础生命值:",@"暴击概率:",@"魔法回复:",@"生命回复:",@"魔法抗性:"];
        for (int i = 0; i<11; i++) {
            UILabel *label=[[UILabel alloc]init];
            label.text=arr[i];
            label.tag=701+i;
            label.textAlignment=NSTextAlignmentRight;
            label.font=[UIFont systemFontOfSize:13];
            label.textColor=[UIColor grayColor];
            [self.contentView addSubview:label];

            
            
            
            
        }
        
        
        
        
    }
    
    
    return self;
    
}


-(void)layoutSubviews
{
    [super layoutSubviews];
    
    
    self.nameLabel.frame=CGRectMake(10, 5, WIDTH-20, 30);
    self.levelSlider.frame=CGRectMake(20, 45, WIDTH-40, 30);
    
    
    
    for (int i = 0; i<11; i++) {
        ((UILabel *)[self.contentView viewWithTag:701+i]).frame=CGRectMake(10, 90+30*i, 70, 20);
        
    }
    
    
    self.levelLabel.frame=CGRectMake(95, 90, WIDTH-95-10, 20);
    self.attackLabel.frame=CGRectMake(95, 90+30, WIDTH-95-10, 20);
    self.speedLabel.frame=CGRectMake(95, 90+30*2, WIDTH-95-10, 20);
    self.baseAttackLabel.frame=CGRectMake(95, 90+30*3, WIDTH-95-10, 20);
    self.baseDefenseLabel.frame=CGRectMake(95, 90+30*4, WIDTH-95-10, 20);
    self.baseMagicLabel.frame=CGRectMake(95, 90+30*5, WIDTH-95-10, 20);
    self.baseHealthLabel.frame=CGRectMake(95, 90+30*6, WIDTH-95-10, 20);
    self.crushLabel.frame=CGRectMake(95, 90+30*7, WIDTH-95-10, 20);
    self.magicRecoverLabel.frame=CGRectMake(95, 90+30*8, WIDTH-95-10, 20);
    self.healthRecoverLabel.frame=CGRectMake(95, 90+30*9, WIDTH-95-10, 20);
    self.magicdefenseLabel.frame=CGRectMake(95, 90+30*10, WIDTH-95-10, 20);
    
    
    
}
-(void)changeValue:(UISlider *)paramSender
{
    
    
    self.levelLabel.text =[NSString stringWithFormat:@"%ld",(NSInteger)self.levelSlider.value];
    self.baseAttackLabel.text = [NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.attackBase.floatValue+self.detailModel.attackLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.attackLevel];
    
    self.baseDefenseLabel.text = [NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.armorBase.floatValue+self.detailModel.armorLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.armorLevel];
    
    self.baseMagicLabel.text = [NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.manaBase.floatValue+self.detailModel.manaLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.manaLevel];
    
    self.baseHealthLabel.text = [NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.healthBase.floatValue+self.detailModel.healthLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.healthLevel];
    
    self.crushLabel.text = [NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.criticalChanceBase.floatValue+self.detailModel.criticalChanceLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.criticalChanceLevel];
    
    self.magicRecoverLabel.text=[NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.manaRegenBase.floatValue+self.detailModel.manaRegenLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.manaRegenLevel];
    
    self.healthRecoverLabel.text=[NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.healthRegenBase.floatValue+self.detailModel.healthRegenLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.healthRegenLevel];
    
    self.magicdefenseLabel.text=[NSString stringWithFormat:@"%0.2f (%@/每级)",self.detailModel.magicResistBase.floatValue+self.detailModel.magicResistLevel.floatValue*(NSInteger)self.levelSlider.value,self.detailModel.magicResistLevel];
    
}



@end
